import java.util.ArrayList;
import java.util.Scanner;

public class IOTest {
    private static int[] flag;
    private static ArrayList<ArrayList<Integer>> res;
    private static ArrayList<Integer> list;
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String s = in.nextLine();
        list = new ArrayList<>();
        for (int i=8;i<s.length();i++){
            int start=i;
            while(Character.isDigit(s.charAt(i))) i++;
            int num = Integer.parseInt(s.substring(start,i));
            list.add(num);
        }
        flag  = new int[list.size()];
        res = new ArrayList<ArrayList<Integer>>();
        dfs(new ArrayList<Integer>());
        System.out.println(res);
    }
    public static void dfs(ArrayList<Integer> reslist){
        if(reslist.size()==list.size()){
            res.add(new ArrayList<>(reslist));
        }
        for(int i=0;i<list.size();++i){
            if(flag[i]!=1){
                reslist.add(list.get(i));
                flag[i]=1;
                dfs(reslist);
                reslist.remove(reslist.size()-1);
                flag[i]=0;
            }
        }
    }
}
